package com.company.project.common.utils;

import org.jsoup.Connection;
import org.jsoup.nodes.Document;

public class JsoupUtil {

    public static Document connect (Connection connection){
        int failCount=0;
        Document doc=null;
        while (failCount<5){
            try{
                doc=connection.timeout(10000).get();
            }catch (Exception e){
                System.out.println(e);
            }finally {
                if(doc != null){
                    break;
                }else{
                    failCount++;
                }
            }
        }
        return  doc;
    }
}
